﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace TestMeterialDesign
{
    /// <summary>
    /// UC1.xaml 的交互逻辑
    /// </summary>
    public partial class UC1 : UserControl
    {
        //public static readonly DependencyProperty ItemsProperty =
        //    DependencyProperty.Register("Items", typeof(ObservableCollection<string>), typeof(UC1), new PropertyMetadata(null));

        //public ObservableCollection<string> Items
        //{
        //    get { return (ObservableCollection<string>)GetValue(ItemsProperty); }
        //    set { SetValue(ItemsProperty, value); }
        //}
        public static readonly DependencyProperty WordProperty =
            DependencyProperty.Register("Word", typeof(string), typeof(UC1), new PropertyMetadata("", ValueChange));

        public string Word
        {
            get { return (string)GetValue(WordProperty); }
            set { SetValue(WordProperty, value); }
        }


        public string[] Items
        {
            get { return (string[])GetValue(ItemsProperty); }
            set { SetValue(ItemsProperty, value); }
        }

        public static readonly DependencyProperty ItemsProperty =
            DependencyProperty.Register("Items", typeof(string[]), typeof(UC1), new PropertyMetadata(null, ValueChange));

        public static void ValueChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var dd = (UC1)d;
            dd.tb.Text = e.NewValue as string;
        }
        public UC1()
        {
            InitializeComponent();
            //DataContext = this;
        }
    }
}
